package com.wsoft.oss.enums;

import lombok.Getter;
import org.springframework.lang.Nullable;

import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.Map;

/**
 * @author z001
 * @Date 2024/9/26 18:39
 */
@Getter
public enum BucketNameEnum {

    /**
     * 公开桶
     */
    PUBLIC(1, "wsoft-public"),
    /**
     * 需登录
     */
    LOGIN(2, "wsoft-login"),
    /**
     * 需权限
     */
    AUTHORITY(3, "wsoft-authority");

    private final Integer type;


    private final String bucketName;


    private static final Map<Integer, BucketNameEnum> MAPPING = new HashMap(16);


    BucketNameEnum(Integer type, String bucketName) {
        this.type = type;
        this.bucketName = bucketName;
    }

    static {
        BucketNameEnum[] var0 = values();
        for (BucketNameEnum fileSizeEnum : var0) {
            MAPPING.put(fileSizeEnum.getType(), fileSizeEnum);
        }
    }


    @NotNull
    public static BucketNameEnum resolve(@Nullable Integer value) {
        if (value != null) {
            return MAPPING.get(value);
        }
        return null;
    }

}
